<!-- $Id: sites_list.htm 7565 2007-03-23 12:09:00Z paulgao $ -->

{if $full_page}
{include file="pageheader.htm"}
{insert_scripts files="../js/utils.js,listtable.js"}

<!-- 商品搜索 -->
{include file="sites_search.htm"}
<!-- 商品列表 -->
<form method="post" action="" name="listForm" onsubmit="return confirmSubmit(this)">
  <!-- start sites list -->
  <div class="list-div" id="listDiv">
{/if}

<table cellpadding="3" cellspacing="1">
  <tr>
    <th>
      <input onclick='listTable.selectAll(this, "checkboxes")' type="checkbox" />
      <a href="javascript:listTable.sort('sites_id'); ">{$lang.record_id}</a>{$sort_sites_id}
    </th>
    <th><a href="javascript:listTable.sort('sites_name'); ">{$lang.sites_name}</a>{$sort_sites_name}</th>
    <th><a href="javascript:listTable.sort('sites_sn'); ">{$lang.sites_sn}</a>{$sort_sites_sn}</th>
    <th><a href="javascript:listTable.sort('shop_price'); ">{$lang.shop_price}</a>{$sort_shop_price}</th>
    <th><a href="javascript:listTable.sort('is_on_sale'); ">{$lang.is_on_sale}</a>{$sort_is_on_sale}</th>
    <th><a href="javascript:listTable.sort('is_best'); ">{$lang.is_best}</a>{$sort_is_best}</th>
    <th><a href="javascript:listTable.sort('is_new'); ">{$lang.is_new}</a>{$sort_is_new}</th>
    <th><a href="javascript:listTable.sort('is_hot'); ">{$lang.is_hot}</a>{$sort_is_hot}</th>

    {if $use_storage}
    <th><a href="javascript:listTable.sort('sites_number'); ">{$lang.sites_number}</a>{$sort_sites_number}</th>
    {/if}

    <th>{$lang.handler}</th>
  <tr>

  {foreach from=$sites_list item=sites}
  <tr>
    <td><input type="checkbox" name="checkboxes[]" value="{$sites.sites_id}" />{$sites.sites_id}</td>
    <td class="first-cell" style="{if $sites.is_promote}color:red;{/if}"><span onclick="listTable.edit(this, 'edit_sites_name', {$sites.sites_id})">{$sites.sites_name|escape:html}</span></td>
    <td><span onclick="listTable.edit(this, 'edit_sites_sn', {$sites.sites_id})">{$sites.sites_sn}</span></td>
    <td align="right"><span onclick="listTable.edit(this, 'edit_sites_price', {$sites.sites_id})">{$sites.shop_price}</span></td>
    <td align="center"><img src="images/{if $sites.is_on_sale}yes{else}no{/if}.gif" onclick="listTable.toggle(this, 'toggle_on_sale', {$sites.sites_id})" /></td>
    <td align="center"><img src="images/{if $sites.is_best}yes{else}no{/if}.gif" onclick="listTable.toggle(this, 'toggle_best', {$sites.sites_id})" /></td>
    <td align="center"><img src="images/{if $sites.is_new}yes{else}no{/if}.gif" onclick="listTable.toggle(this, 'toggle_new', {$sites.sites_id})" /></td>
    <td align="center"><img src="images/{if $sites.is_hot}yes{else}no{/if}.gif" onclick="listTable.toggle(this, 'toggle_hot', {$sites.sites_id})" /></td>

    {if $use_storage}
    <td align="right"><span onclick="listTable.edit(this, 'edit_sites_number', {$sites.sites_id})">{$sites.sites_number}</span></td>
    {/if}

    <td align="center">
      <a href="../sites.php?id={$sites.sites_id}" target="_blank" title="{$lang.view}"><img src="images/icon_view.gif" width="16" height="16" border="0" /></a>
      <a href="sites.php?act=edit&sites_id={$sites.sites_id}" title="{$lang.edit}"><img src="images/icon_edit.gif" width="16" height="16" border="0" /></a>
      <a href="sites.php?act=copy&sites_id={$sites.sites_id}" title="{$lang.copy}"><img src="images/icon_copy.gif" width="16" height="16" border="0" /></a>
      <a href="javascript:;" onclick="listTable.remove({$sites.sites_id}, '{$lang.trash_sites_confirm}')" title="{$lang.trash}"><img src="images/icon_trash.gif" width="16" height="16" border="0" /></a>
    </td>
  </tr>

  {foreachelse}
  <tr><td class="no-records" colspan="10">{$lang.no_records}</td></tr>
  {/foreach}

</table>
<!-- end sites list -->

<!-- 分页 -->
<table id="page-table" cellspacing="0">
  <tr>
    <td>
      <input type="hidden" name="act" value="batch" />
      <select name="type" id="selAction" onchange="changeAction()">
        <option value="">{$lang.select_please}</option>
        <option value="trash">{$lang.trash}</option>
        <option value="on_sale">{$lang.on_sale}</option>
        <option value="not_on_sale">{$lang.not_on_sale}</option>
        <option value="best">{$lang.best}</option>
        <option value="not_best">{$lang.not_best}</option>
        <option value="new">{$lang.new}</option>
        <option value="not_new">{$lang.not_new}</option>
        <option value="hot">{$lang.hot}</option>
        <option value="not_hot">{$lang.not_hot}</option>
        <option value="move_to">{$lang.move_to}</option>
      </select>
      <select name="target_cat" style="display:none" onchange="checkIsLeaf(this)"><option value="0">{$lang.select_please}</caption>{$cat_list}</select>
      <input type="submit" value="{$lang.button_submit}" id="btnSubmit" name="btnSubmit" class="button" disabled="true" />
    </td>
    <td align="right" nowrap="true">

    {include file="page.htm"}

    </td>
  </tr>
</table>

{if $full_page}
</div>
</form>

<script type="text/javascript">
  listTable.recordCount = {$record_count};
  listTable.pageCount = {$page_count};

  {foreach from=$filter item=item key=key}
  listTable.filter.{$key} = '{$item}';
  {/foreach}

  {literal}
  

  /**
   * @param: bool ext 其他条件：用于转移分类
   */
  function confirmSubmit(frm, ext)
  {
      if (frm.elements['type'].value == 'trash')
      {
          return confirm(batch_trash_confirm);
      }
      else if (frm.elements['type'].value == 'not_on_sale')
      {
          return confirm(batch_no_on_sale);
      }
      else if (frm.elements['type'].value == 'move_to')
      {
          ext = (ext == undefined) ? true : ext;
          return ext && frm.elements['target_cat'].value != 0;
      }
      else if (frm.elements['type'].value == '')
      {
          return false;
      }
      else
      {
          return true;
      }
  }

  function changeAction()
  {
      var frm = document.forms['listForm'];

      // 切换分类列表的显示
      frm.elements['target_cat'].style.display = frm.elements['type'].value == 'move_to' ? '' : 'none';

      if (!document.getElementById('btnSubmit').disabled &&
          confirmSubmit(frm, false))
      {
          frm.submit();
      }
  }

  /**
   * 检查是否底级
   */
  function checkIsLeaf(selObj)
  {
      if (selObj.options[selObj.options.selectedIndex].className != 'leafCat')
      {
          alert(sites_cat_not_leaf);
          selObj.options.selectedIndex = 0;
      }
  }
{/literal}
</script>
{include file="pagefooter.htm"}
{/if}